//
//  ImageSplicingHomeViewController.m
//  TSImageFilterDemo
//
//  Created by ciyouzen on 2017/2/25.
//  Copyright © 2017年 dvlproad. All rights reserved.
//

#import "ImageSplicingHomeViewController.h"
#import <TSDemo_ImageFilter/TSImageFilterViewController.h>
#import <CQDemoKit/CQTSLocImagesUtil.h>
#import <CQDemoKit/CQTSNetImagesUtil.h>


#import "TSSplicingTemplateListViewController.h"
#import "TSSplicingTemplateListViewController2.h"

#import "NormalSplicingTemplateViewController.h"
#import "ImageSplicingTemplateViewController.h"

#import "MeituEditStyleViewController.h"



@interface ImageSplicingHomeViewController () {
    
}

@end

@implementation ImageSplicingHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = NSLocalizedString(@"图片拼接首页", nil);
    

    NSMutableArray *sectionDataModels = [[NSMutableArray alloc] init];
    
    // 模板列表
    {
        CQDMSectionDataModel *sectionDataModel = [[CQDMSectionDataModel alloc] init];
        sectionDataModel.theme = @"模板列表";
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"模板列表";
            module.actionBlock = ^{
                NSArray<UIImage *> *images = @[[UIImage imageNamed:@"bmp1.bmp"],
                                               [UIImage imageNamed:@"bmp2.bmp"],
                                               [UIImage imageNamed:@"image1.jpg"],
                                               [UIImage imageNamed:@"image2.jpg"],
                                               [UIImage imageNamed:@"0.png"],
                                            ];
                TSSplicingTemplateListViewController *viewController = [[TSSplicingTemplateListViewController alloc] initWithImages:images];
                viewController.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:viewController animated:YES];
            };
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"模板列表XL(BL两张(一张本地+一张远程))";
            module.actionBlock = ^{
                NSArray<UIImage *> *images = @[[UIImage imageNamed:@"bmp1.bmp"],
                                               [CQTSNetImagesUtil cjts_imageUrl1],
                                            ];
                TSSplicingTemplateListViewController2 *viewController = [[TSSplicingTemplateListViewController2 alloc] initWithImages:images];
                viewController.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:viewController animated:YES];
            };
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"模板列表XL(BL两张本地)";
            module.actionBlock = ^{
                NSArray<UIImage *> *images = @[[UIImage imageNamed:@"bmp1.bmp"],
                                               [UIImage imageNamed:@"bmp2.bmp"],
                                            ];
                TSSplicingTemplateListViewController2 *viewController = [[TSSplicingTemplateListViewController2 alloc] initWithImages:images];
                viewController.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:viewController animated:YES];
            };
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"模板列表XL(BL三张本地)";
            module.actionBlock = ^{
                NSArray<UIImage *> *images = @[[UIImage imageNamed:@"bmp1.bmp"],
                                               [UIImage imageNamed:@"bmp2.bmp"],
                                               [UIImage imageNamed:@"image1.jpg"],
                                            ];
                TSSplicingTemplateListViewController2 *viewController = [[TSSplicingTemplateListViewController2 alloc] initWithImages:images];
                viewController.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:viewController animated:YES];
            };
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"模板列表XL(BL四张本地)";
            module.actionBlock = ^{
                NSArray<UIImage *> *images = @[[UIImage imageNamed:@"bmp1.bmp"],
                                               [UIImage imageNamed:@"bmp2.bmp"],
                                               [UIImage imageNamed:@"image1.jpg"],
                                               [UIImage imageNamed:@"image2.jpg"],
                                            ];
                TSSplicingTemplateListViewController2 *viewController = [[TSSplicingTemplateListViewController2 alloc] initWithImages:images];
                viewController.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:viewController animated:YES];
            };
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"模板列表XL(BL五张本地)";
            module.actionBlock = ^{
                NSArray<UIImage *> *images = @[[UIImage imageNamed:@"bmp1.bmp"],
                                               [UIImage imageNamed:@"bmp2.bmp"],
                                               [UIImage imageNamed:@"image1.jpg"],
                                               [UIImage imageNamed:@"image2.jpg"],
                                               [UIImage imageNamed:@"0.png"],
                                            ];
                TSSplicingTemplateListViewController2 *viewController = [[TSSplicingTemplateListViewController2 alloc] initWithImages:images];
                viewController.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:viewController animated:YES];
            };
            [sectionDataModel.values addObject:module];
        }
        [sectionDataModels addObject:sectionDataModel];
    }
    
    // 图片拼接
    {
        CQDMSectionDataModel *sectionDataModel = [[CQDMSectionDataModel alloc] init];
        sectionDataModel.theme = @"测试 图片拼接 等";
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"图片拼接(N年前写的)";
            module.classEntry = [TSImageFilterViewController class];
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"MT图片拼接模板(Normal)";
            module.classEntry = [NormalSplicingTemplateViewController class];
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"MT图片拼接模板(Image)";
            module.classEntry = [ImageSplicingTemplateViewController class];
            [sectionDataModel.values addObject:module];
        }
        {
            CQDMModuleModel *module = [[CQDMModuleModel alloc] init];
            module.title = @"MT图片拼接";
            module.actionBlock = ^{
//                NSArray<CQTSLocImageDataModel *> *imageModels = [CQTSLocImagesUtil __getTestLocalImageDataModelsWithCount:5];
//                NSMutableArray<UIImage *> *images = [[NSMutableArray alloc] init];
//                for (CQTSLocImageDataModel *imageModel in imageModels) {
//                    [images addObject:imageModel.image];
//                }
                
                NSArray<UIImage *> *images = @[[UIImage imageNamed:@"bmp1.bmp"],
                                               [UIImage imageNamed:@"bmp2.bmp"],
                                               [UIImage imageNamed:@"image1.jpg"],
                                               [UIImage imageNamed:@"image2.jpg"],
                                               [UIImage imageNamed:@"0.png"],
                                            ];
                
                MeituEditStyleViewController *meituEditVC = [[MeituEditStyleViewController alloc] init];
                meituEditVC.assets = images;
                meituEditVC.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:meituEditVC animated:YES];
            };
            [sectionDataModel.values addObject:module];
        }
        [sectionDataModels addObject:sectionDataModel];
    }
    
    
    
    self.sectionDataModels = sectionDataModels;
}


#pragma mark - Touch
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
